<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<jsp:useBean id="status" class="java.lang.String" scope="request"/>
<jsp:useBean id="newSvcPlanID" class="java.lang.Long" scope="request"/>
<jsp:useBean id="errorMessage" class="java.lang.String" scope="request"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Add Service Plan</title>
        <c:url var="scriptSrc" value="/javascript/validation.js" />
        <script type="text/javascript" src="${scriptSrc}"></script>
        <c:url var="scriptSrc" value="/javascript/validation_addServicePlan.js" />
        <script type="text/javascript" src="${scriptSrc}"></script>
        <c:url var="stylesheetSrc" value="/stylesheet/default.css" />
        <link rel="stylesheet" type="text/css" href="${stylesheetSrc}" media="screen, print" />
    </head>
    
    
    
    <body onload="javascript:init('formAddServicePlan');">
        <h1>Add Service Plan</h1>
        <c:url var="linkHref" value="/Controller" />
        <a href="${linkHref}">Home</a><br/><br/>
        <c:url var="formAction" value="/Controller?action=saveServicePlan" />
        
        
        <form name="formAddServicePlan" id="formAddServicePlan" action="${formAction}" method="post">
            <c:if test="${status == 'success'}">
                <font color="green">Service Plan ID ${newSvcPlanID} added successfully!</font><br/>
            </c:if>
            <c:if test="${status == 'error'}">
                <font color="red">An error has occurred while adding the new event: ${errorMessage}!</font><br/>
            </c:if>
            <table border="0">
                <tr><td>Plan Name: </td><td><input type="text" name="planName" id="planName" value="<%=(request.getParameter("planName") != null) ? (request.getParameter("planName")) : ("")%>" /><span class="errorMessage" id="lblErrSvcPlanName"></span></td></tr>
                <tr><td>Monthly Subscription Fee: </td><td><input type="text" name="mthFee" id="mthFee" value="<%=(request.getParameter("mthFee") != null) ? (request.getParameter("mthFee")) : ("")%>" /><span class="errorMessage" id="lblErrMthFee"></span></td></tr>
                <tr><td>Commission % 1: </td><td><input type="text" name="comm1" id="comm1" value="<%=(request.getParameter("comm1") != null) ? (request.getParameter("comm1")) : ("")%>" /><span class="errorMessage" id="lblErrComm1"></span></td></tr>
                <tr><td>Commission % 2: </td><td><input type="text" name="comm2" id="comm2" value="<%=(request.getParameter("comm2") != null) ? (request.getParameter("comm2")) : ("")%>" /><span class="errorMessage" id="lblErrComm2"></span></td></tr>
                <tr><td>Initial Fee: </td><td><input type="text" name="init_Fee" id="init_Fee" value="<%=(request.getParameter("init_Fee") != null) ? (request.getParameter("init_Fee")) : ("")%>" /><span class="errorMessage" id="lblErrInitFee"></span></td></tr>
                <tr><td>Per Unit Fee: </td><td><input type="text" name="perUnitFee" id="perUnitFee" value="<%=(request.getParameter("perUnitFee") != null) ? (request.getParameter("perUnitFee")) : ("")%>" /><span class="errorMessage" id="lblErrPerUnitFee"></span></td></tr>

                
                <tr><td colspan="2"><input type="submit" value="Add Service Plan" /> <input type="reset" value="Clear" /></td></tr>
            </table>
        </form>
    </body>
</html>